import { reactive, computed } from 'vue';

const state = reactive<{
  /**
   * 交接记录
   */
  content?: ScheduleApp.AppScheduleRecord;
}>({
  content: {},
});

/**
 * 图片文件列表
 */
const imgList = computed(() => {
  if (!state.content || !state.content.file || !state.content.file.length) return [];

  return [...(state.content.file as ScheduleApp.FileDto[])]
    .filter((file) => {
      return file.fileType === 1;
    })
    .map((file) => {
      return {
        key: file.id || '',
        src: file.fileUrl || '',
      };
    });
});

export { state, imgList };
